<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <ul>
    <li>
      <a href="./router.html?page=page1">page1</a>
    </li>
    <li>
      <a href="./router.html?page=page2">page2</a>
    </li>
  </ul>
  <div id="content">
    <h1>Page1</h1>
  </div>
  <script>
    window.addEventListener('hashchange', () => {
      const hash = location.hash.slice(1)
      switch(hash) {
        case '/page1':
          document.querySelector('#content').innerHTML = `
            <h1>page1</h1>
          `
        break;
        case '/page2':
          document.querySelector('#content').innerHTML = `
            <h1>page2</h1>
          `
        break;
        default: 
          document.querySelector('#content').innerHTML = `
            <h1>page not found.</h1>
          `
      }
    })
  </script>
</body>
</html>